package com.itheima.dao;

import com.itheima.domain.Permission;
import com.itheima.domain.Role;
import com.itheima.domain.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface PermissionDao {

    @Select("select * from permission")
    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "permissionName",property = "permissionName"),
            @Result(column = "url",property = "url"),
    })
    List<Permission> findAll();

    @Insert("insert into permission (id,permissionName,url) values(#{id},#{permissionName},#{url})")
    void save(Permission permission);

    @Delete("delete from permission where id=#{id}")
    void deleteById(String id);

    //级联删除
    @Delete("delete from role_permission where permissionId=#{id}")
    void deleteRP(String id);

}
